package cn.sccl.dirms.dev.model;

import cn.sccl.common.exception.BusinessException;
import cn.sccl.common.model.BaseModel;

/**
 * 图形集信息
 * 数据库表 t_dev_graphs 的实体对象
 * Created by liupan on 2017-06-25.
 */
public class Graphs extends BaseModel {
    /**
     * 表名
     */
    public final static String TABLE_NAME = "t_dev_graphs";

    private java.lang.String grsNo;//图形模板编号，对应一组图形
    private java.lang.String grsName;//图形集名称
    private java.lang.String grsType;//图形集分类：监控/报表/详细信息
    private java.lang.String style;//
    private java.lang.String params;//
    private java.lang.String remark;//备注信息
    private java.lang.Long tmpFlag;//是否模板：0 否  1是 默认为0
    private java.lang.String widgetData;//布局数据

    public void setGrsNo(java.lang.String grsNo) {
        this.grsNo = grsNo;
    }

    public java.lang.String getGrsNo() {
        return this.grsNo;
    }

    public void setGrsName(java.lang.String grsName) {
        this.grsName = grsName;
    }

    public java.lang.String getGrsName() {
        return this.grsName;
    }

    public void setGrsType(java.lang.String grsType) {
        this.grsType = grsType;
    }

    public java.lang.String getGrsType() {
        return this.grsType;
    }

    public void setStyle(java.lang.String style) {
        this.style = style;
    }

    public java.lang.String getStyle() {
        return this.style;
    }

    public void setParams(java.lang.String params) {
        this.params = params;
    }

    public java.lang.String getParams() {
        return this.params;
    }

    public void setRemark(java.lang.String remark) {
        this.remark = remark;
    }

    public java.lang.String getRemark() {
        return this.remark;
    }

    public void setTmpFlag(java.lang.Long tmpFlag) {
        this.tmpFlag = tmpFlag;
    }

    public java.lang.Long getTmpFlag() {
        return this.tmpFlag;
    }

    public String getWidgetData() {
        return widgetData;
    }

    public void setWidgetData(String widgetData) {
        this.widgetData = widgetData;
    }

    /**
     * clone一个对象。
     *
     * @param cls 需要克隆的对象类型，只能是当前类的子类
     * @param <T>
     * @return
     * @throws IllegalAccessException
     * @throws InstantiationException
     */
    public <T extends Graphs> T clone(Class
                                              <T> cls) {
        try {
            T t = cls.newInstance();
            t.setId(this.
                    getId());
            t.setGrsNo(this.
                    getGrsNo());
            t.setGrsName(this.
                    getGrsName());
            t.setGrsType(this.
                    getGrsType());
            t.setStyle(this.
                    getStyle());
            t.setParams(this.
                    getParams());
            t.setRemark(this.
                    getRemark());
            t.setTmpFlag(this.
                    getTmpFlag());
            t.setWidgetData(this.
                    getWidgetData());
            t.setCreateTime(this.
                    getCreateTime());
            t.setUpdateTime(this.
                    getUpdateTime());
            t.setDeleteFlag(this.
                    isDeleteFlag());
            return t;
        } catch (Exception e) {
            e.printStackTrace();
            throw new BusinessException("对象克隆失败，请克隆的目标对象是否具有无参的构造函数。", e.getCause());
        }
    }
}